<?php

function str_GetGuid(): string
{
    return  strtoupper(md5(uniqid(rand(), true)));
}

function str_getBetween($string, $keyword1, $keyword2) {
    $startPos = strpos($string, $keyword1);
    if ($startPos === false) {
        return '';
    }
    $endPos = strpos($string, $keyword2, $startPos + strlen($keyword1));
    if ($endPos === false) {
        return '';
    }
    $textBetweenKeywords = substr($string, $startPos + strlen($keyword1), $endPos - $startPos - strlen($keyword1));
    return $textBetweenKeywords;
}


//文本_取文本关键字左边,
function str_getStringLeft($string, $keyword) {
    $position = strpos($string, $keyword);
    if ($position !== false) {
        $leftContent = substr($string, 0, $position);
        //$rightContent = substr($string, $position + strlen($keyword));
        return $leftContent;
    } else {
        return "";
    }
}
//文本_取文本关键字右边,
function str_getStringright($string, $keyword) {
    $position = strpos($string, $keyword);
    if ($position !== false) {
        //$leftContent = substr($string, 0, $position);
        $rightContent = substr($string, $position + strlen($keyword));
        return $rightContent;
    } else {
        return "";
    }
}
